<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2020/6/28
 * Time: 14:54
 */

namespace app\common\model\mall;

use app\common\model\TimeModel;


class ItemOrderList extends TimeModel
{
    protected $deleteTime = 'delete_time';

    public static function onAfterInsert($data){

        //$self = new static();
        $article = self::withoutGlobalScope()->find($data->id);

        $article->withoutGlobalScope()->where('id',$data->id)->save(['app_id'=>self::get_appId()]);


    }

    /**
     * 关联商品
     */
    public function Goods(){
        return $this->belongsTo('app\common\model\mall\Item','item_id','id')->field('id,title,thumb,image,goods_price,store_id');
    }

    /**
     * 关联商品规格
     */
    public function GoodsSku(){
        return $this->belongsTo('app\common\model\mall\ItemSku','sku_id','id')->field('id,spec_sku_name,sku_image,goods_price');
    }
}